package com.yu.boot.config;

import com.yu.boot.admin.common.secure.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {

    @Autowired
    LoginInterceptor loginInterceptor;

    /**
     * {@inheritDoc}
     * </br>注册 拦截器
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor);
    }

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.setOrder(0);
//        registry.addViewController("/discovery").setViewName("discovery");
//        registry.addViewController("/plugin").setViewName("plugin");

    }

}
